<template>
  <div>
    <a-row type="flex" v-has="'content:publish'">
      <a-col flex="1">
        <a-tabs type="card" @change="tabChange">
          <a-tab-pane key="mine" tab="我的内容"></a-tab-pane>
          <a-tab-pane key="all" tab="全部内容"></a-tab-pane>
        </a-tabs>
      </a-col>
      <a-col>
        <a-button type="primary" @click="publishTonew">选择内容发布第三方平台</a-button>
        <a-button style="margin-left:10px" type="primary" @click="publish">第三方平台发布</a-button>
        <a-button style="margin-left:10px" type="primary" @click="handleBin">回收站</a-button>


      </a-col>
    </a-row>
    <a-spin :spinning="loading">
      <!-- <a-empty v-if="!loading && ipagination.total==0"></a-empty>
      <div class="item" v-for="(item,index) in dataSource" :key="index">
        <div class="item-title">{{item.contentTitle}}</div>
        <div class="item-content">
          <img class="item-icon" :src="item.mbLogoUrl||defaultImg">
          <div style="flex:1">
            <div class="item-content-title">{{item.contentSubTitle||'暂无副标题'}}</div>
            <a-row type="flex">
              <a-col flex="70px">任务类型</a-col>
              <a-col>{{getContentTypeName(item.contentType)}}</a-col>
            </a-row>
            <a-row type="flex">
              <a-col flex="70px">主题名称</a-col>
              <a-col>{{item.themeName||'无'}}</a-col>
            </a-row>
            <a-row type="flex">
              <a-col flex="70px">创建时间</a-col>
              <a-col>{{item.createTime}}</a-col>
            </a-row>
            <a-row type="flex" :gutter="8">
              <a-col>
                <a-button size="small" type="primary" @click="look(item)">查看
                  <a-icon type="eye"/>
                </a-button>
              </a-col>
              <a-col>
                <a-button size="small" type="primary" @click="publishNet(item)">发布到官网</a-button>
              </a-col>
              <template v-has="'content:publish'">
                <a-col v-if="item.contentType==1">
                  <a-button size="small" type="primary" :title="item.isTemplate==1?'已同步':''"
                            :disabled="item.isTemplate==1"
                             @click="addTemplate(item,index)">
                    同步到模板
                    <a-icon type="sync" :spin="syncing&&index===currentIndex"/>
                  </a-button>
                </a-col>
                <a-col>
                  <a-button size="small" type="primary"
                            :disabled="item.isRelease!=3"
                            @click="showPublishSetting(item,index)">发布
                    <i class="iconfont icon-fabu"></i>
                  </a-button>
                </a-col>
                <a-col>
                  <a-button size="small" type="primary"

                            @click="deleteContent(item,index)">删除
                    <i class="iconfont icon-fabu"></i>
                  </a-button>
                </a-col>
              </template>
            </a-row>
          </div>
        </div>
      </div>
      <a-pagination style="text-align: center;" @change="loadData" v-model="ipagination.current"
                    :total="ipagination.total"></a-pagination> -->
        <a-table
            ref="table"
            bordered
            size="middle"
            rowKey="contentTitle"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            class="j-table-force-nowrap"
            @change="handleTableChange"
            >
            <!-- <div slot="img" slot-scope="text, record">
              <img class="item-icon" style="margin: 0 auto" :src="record.mbLogoUrl||record.pcLogoUrl||defaultImg">
            </div> -->
            <span slot="contentType" slot-scope="text, record">
              {{getContentTypeName(record.contentType)}}
            </span>
            <span slot="action" slot-scope="text, record">
              <a-button size="small" type="primary" @click="look(record)">查看
                  <a-icon type="eye"/>
              </a-button>

              <a-divider type="vertical"  style="margin-left:10px"/>
              <a-button style="margin-left:10px" size="small" type="primary" @click="publishNet(record)">发布到官网</a-button>
              <a-divider type="vertical"  style="margin-left:10px"/>
                  <a-button style="margin-left:10px" v-if="record.contentType==1" size="small" type="primary" :title="record.isTemplate==1?'已同步':''"
                            :disabled="record.isTemplate==1"
                             @click="addTemplate(record,index)">
                    同步到模板
                    <a-icon type="sync" :spin="syncing&&index===currentIndex"/>
                  </a-button>
                <a-divider type="vertical"  style="margin-left:10px"/>
                  <a-button style="margin-left:10px" size="small" type="primary"
                            :disabled="record.isRelease!=3"
                            @click="showPublishSetting(record,index)">发布
                    <i class="iconfont icon-fabu"></i>
                  </a-button>
                <a-divider type="vertical" style="margin-left:10px" />
                <a-button style="margin-left:10px" size="small" type="primary"
                            @click="deleteContent(record,index)">删除
                    <i class="iconfont icon-fabu"></i>
                  </a-button>
            </span>
          </a-table>
    </a-spin>
    <preview-with-content-info v-if="showDetail" :visible.sync="showDetail"
                               :content-info="currentItem"></preview-with-content-info>
    <content-publish-model :visible.sync="showPublishModel"></content-publish-model>
    <publish-setting ref="publishSetting" @refresh="loadData"></publish-setting>
    <a-modal
      title="回收站"
      :visible="visible"
      @ok="closeBin"
      @cancel="closeBin"
      :width="1000"
      :bodyStyle="{maxHeight: '500px', overflow: 'auto'}"
    >

      <a-table
        ref="table"
        size="small"
        bordered
        rowKey="index"
        :columns="delColumns"
        :dataSource="delDataSource"
        :pagination="false"
        >
        <span slot="action" slot-scope="text, record">
              <a @click="recover(record)">恢复</a>
            </span>
      </a-table>
    </a-modal>
    <a-modal
      :visible="showPublishNewModel || showPublishNewModelDirect == true"
      title="内容发布"
      :zIndex="100"
      width="90%"
      @cancel="closePublish"
      :footer="null"
    >
      <!-- <a-row v-if="process > 0"> <a-progress :percent="process" style="margin-bottom: 30px" /> </a-row> -->
      <a-spin :spinning="spinDown" :tip="spinDetail">
        <a-spin :spinning="previewloading">
          <a-row style="display: flex;" v-if="showPublishNewModelDirect == false">
            <a-button type="primary " class="ml20" @click="perStep" v-if="step >= 1">
              新增
            </a-button>
            <a-steps :current="step" style="width: 80%;margin: 0 auto 20px;">
              <a-step title="选择内容"></a-step>
              <a-step title="预览内容"></a-step>
              <!-- <a-step title="发布内容"></a-step> -->
            </a-steps>
          </a-row>
          <a-row type="flex" :gutter="16">
            <!-- 第一步 -->

            <a-col flex="1" v-if="step == 0 && showPublishNewModelDirect == false" style="width: 100%">
              <a-tabs @change="tabChange" :active-key="queryParam.contentType">
                <a-tab-pane tab="文章" key="1"></a-tab-pane>
                <a-tab-pane tab="横版视频" key="2"></a-tab-pane>
                <a-tab-pane tab="竖版视频" key="3"></a-tab-pane>
                <!-- <a-tab-pane tab="短内容" key="4"></a-tab-pane> -->

                <!-- <a-tab-pane tab="音频" key="3"></a-tab-pane>
            <a-tab-pane tab="h5" key="4"></a-tab-pane> -->
              </a-tabs>
              <a-form-model layout="inline" class="j-inline-form">
                <a-form-model-item>
                  <a-input-search v-model="queryParam.contentTitle" placeholder="请输入内容标题"></a-input-search>
                </a-form-model-item>
                <a-button type="primary" class="mt4" @click="searchQuery" icon="search">查询</a-button>
                <a-button type="primary" class="mt4" @click="searchReset" icon="reload" style="margin-left: 8px"
                >重置</a-button
                >
              </a-form-model>
              <a-table
                size="middle"
                rowKey="contentNo"
                :columns="columns2"
                :dataSource="dataSource"
                :pagination="ipagination"
                :loading="loading"
                :rowSelection="{ selectedRowKeys, onChange: onSelectChange, type: 'checkbox' }"
                class="j-table-force-nowrap"
                @change="handleTableChange"
              >
              </a-table>
            </a-col>

            <!-- 第二步 -->
            <a-col
              flex="2"
              v-if="step >= 1 && showPublishNewModelDirect == false"
              style="overflow-y: auto; max-height: 500px;"
            >
              <a-row type="flex">
                <!-- 左侧已选内容预览 -->
                <a-col flex="1" style="width: 300px">
                  <div class="stepSecond">
                    <!-- {{ selectedRows }} -->
                    <div class="step-left">
                      <!-- {{ selectedRows[0] }} {{ selectedRows[0].contentTitle }} - {{ selectedRows[0].tempBanner }} -->
                      <draggable v-model="selectedRows">
                        <div class="tab-li" v-for="(item, index) in selectedRows" :key="index">
                          <div
                            class="tab-li-cont"
                            :class="{ active: selectedRowsIndex === index }"
                            @click="selectedRowsIndex = index"
                          >
                            <img :src="item.mbLogoUrl" class="left-img" />

                            <div class="tab-title">{{ item.contentTitle }}</div>
                          </div>
                          <div class="tab-li-dele" @click="deleteSelectRow(index)">
                            <div v-if="selectedRowsIndex === index" class="active"><a-icon type="delete" /></div>
                          </div>
                        </div>
                      </draggable>

                      <div class="add-content" @click="perStep">
                        <a-icon type="plus-circle" /> <span class="ml5">新增内容</span>
                      </div>
                    </div>
                    <div class="step-right">
                      <div
                        v-if="
                          selectedRows[selectedRowsIndex].videoUrl == null &&
                            selectedRows[selectedRowsIndex].content != null
                        "
                        v-html="selectedRows[selectedRowsIndex].content"
                        class="contentBox"
                      ></div>
                      <div
                        v-if="
                          selectedRows[selectedRowsIndex].videoUrl == null &&
                            selectedRows[selectedRowsIndex].htmlUrl != null
                        "
                        v-html="selectedRows[selectedRowsIndex].htmlUrl"
                        class="contentBox"
                      ></div>

                      <video
                        v-if="selectedRows[selectedRowsIndex].videoUrl != null"
                        :src="selectedRows[selectedRowsIndex].videoUrl"
                        width="100%"
                        controls="controls"
                      ></video>
                    </div>
                  </div>
                </a-col>
              </a-row>
            </a-col>
            <a-col flex="2" v-if="showPublishNewModelDirect == true" style="overflow-y: auto; max-height: 500px;">
              <a-input
                style="width: 500px;marginBottom: 20px"
                v-model="tempTitle"
                placeholder="请输入内容标题"
              ></a-input>
              <Editor editor-type="EditorM" ref="Editor" @editorCont="handerEditorCont"></Editor>
            </a-col>
            <!-- 右侧发布配置 -->
            <a-col
              flex="1"
              v-if="step >= 1 || showPublishNewModelDirect == true"
              style="overflow-y: auto; max-height: 500px; display: flex;"
            >
              <div class="col-left">
                <div class="nav-li " v-for="(item, index) in platformSelected" :key="index">
                  <img :src="getPlatFormLogo(item)" alt="" @click="changeSelectedPlatform(item)" />
                </div>
              </div>
              <div class="col-right col-right-dialog">
                <!-- 发布内容 -->
                <a-form-model ref="ruleForm" :model="form" :rules="rules">
                  <a-form-model-item label="账号" class="model-row-styl" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <!-- 已选账号 -->
                    <div
                      v-if="form.accountNameListSelected && form.accountNameListSelected.length > 0"
                      style="display: inline-block;"
                    >
                      <a-avatar
                        v-for="(item, index) in form.accountNameListSelected"
                        :key="index"
                        :src="item.avatar"
                        style="margin-right: 10px;"
                        @click="getHot(item, index)"
                      ></a-avatar>
                    </div>
                    <!-- 添加账号 -->
                    <a-avatar style="cursor: pointer;" @click="addAccountModalShow">+</a-avatar>
                  </a-form-model-item>
                  <!-- 抖音专场 -->
                  <template v-if="tempPlatformId == 19">
                    <!-- 抖音-封面 -->
                    <a-form-model-item
                      label="封面"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                    >
                      <div class="radioType">
                        <a-radio-group name="radioGroup" :default-value="1">
                          <a-radio :value="1">
                            自动
                          </a-radio>
                        </a-radio-group>
                        <div>
                          <a-tooltip>
                            <template slot="title">
                              say something!
                            </template>
                            <a-icon type="question-circle" />
                          </a-tooltip>
                        </div>
                      </div>
                      <div class="tiktok-fc-intro">优质的封面有利于推荐，请使用清晰度较高的图片</div>
                      <img :src="tempBanner" class="tiktok-img" width="200px" />
                    </a-form-model-item>
                    <!-- 抖音描述 -->
                    <a-form-model-item
                      label="描述"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                    >
                      <a-textarea placeholder="Basic usage" :maxLength="1000" :rows="4" />
                    </a-form-model-item>
                    <a-form-model-item
                      label="话题"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                    >
                      <div>
                        <template v-for="(tag, index) in tags">
                          <a-tooltip v-if="tag.length > 20" :key="tag" :title="tag">
                            <a-tag :key="tag" :closable="index !== 0" color="cyan" @close="() => handleClose(tag)">
                              {{ `${tag.slice(0, 20)}...` }}
                            </a-tag>
                          </a-tooltip>
                          <a-tag v-else :key="tag" :closable="index !== 0" color="cyan" @close="() => handleClose(tag)">
                            {{ tag }}
                          </a-tag>
                        </template>
                        <a-input
                          v-if="inputVisible"
                          ref="input"
                          type="text"
                          :style="{ width: '78px' }"
                          :value="inputValue"
                          @change="handleInputChange"
                          @blur="handleInputConfirm"
                          @keyup.enter="handleInputConfirm"
                        />
                        <a-tag v-else style="background: #fff; borderStyle: dashed;" @click="showInput">
                          <a-icon type="plus" /> 点击添加标签
                        </a-tag>
                      </div>
                      <div class="tiktok-fc-intro mt10">您可以添加5个标签，点击按钮输入，回车完成新增</div>
                    </a-form-model-item>
                    <a-form-model-item
                      label="@好友"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                    >
                      <a-select ref="select" mode="multiple" v-model="form.friends" placeholder="请选择好友">
                        <a-select-option v-for="(item, index) in tempFriendList" :key="index" :value="item.id">{{
                            item.name
                          }}</a-select-option>
                      </a-select>
                      <div class="tiktok-fc-intro mt10">您可以添加100个好友</div>
                    </a-form-model-item>
                    <a-form-model-item
                      label="关联热点"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                    >
                      <a-select ref="select" v-model="form.hot" placeholder="请选择热点">
                        <a-select-option v-for="(item, index) in tempHotList" :key="index" :value="item.word">{{
                            item.word
                          }}</a-select-option>
                      </a-select>
                      <div class="tiktok-fc-intro mt10">您可以申请1个关键热点</div>
                    </a-form-model-item>
                    <a-form-model-item
                      label="分类设置"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                    >
                      <a-select default-value="lucy" style="width: 100%">
                        <a-select-option value="jack">
                          Jack
                        </a-select-option>
                        <a-select-option value="lucy">
                          Lucy
                        </a-select-option>
                        <a-select-option value="disabled" disabled>
                          Disabled
                        </a-select-option>
                        <a-select-option value="Yiminghe">
                          yiminghe
                        </a-select-option>
                      </a-select>
                    </a-form-model-item>
                    <a-form-model-item
                      label="谁可以看"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                    >
                      <a-radio-group v-model="form.accountNameList[tempIndex].adType">
                        <a-radio value="1">公开</a-radio>
                        <a-radio value="2">好友可见</a-radio>
                        <a-radio value="3">自己可以见</a-radio>
                      </a-radio-group>
                    </a-form-model-item>
                    <a-form-model-item
                      label="是否同步"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                    >
                      <a-checkbox-group v-model="form.accountNameList[tempIndex].yc">
                        <a-checkbox value="1">同步今日头条</a-checkbox>
                      </a-checkbox-group>
                    </a-form-model-item>
                    <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" class="model-row-styl">
                      <div style="color: rgba(0, 0, 0, 0.85);;">允许他人保存视频:</div>
                      <a-radio-group v-model="form.accountNameList[tempIndex].adType" style="padding-left: 60px;">
                        <a-radio value="1">允许</a-radio>
                        <a-radio value="2">不允许</a-radio>
                      </a-radio-group>
                    </a-form-model-item>
                    <a-form-model-item
                      label="定时发布"
                      :labelCol="labelCol"
                      :wrapperCol="wrapperCol"
                      class="model-row-styl"
                      v-if="form.accountNameList && form.accountNameList.length > 0"
                    >
                      <a-date-picker
                        v-model="form.accountNameList[tempIndex].prePubTime"
                        show-time
                        format="YYYY-MM-DD HH:mm:ss"
                        placeholder="选择时间"
                        @change="handleStartOpenChange"
                      />
                    </a-form-model-item>
                    <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" class="model-row-styl">
                      <div style="color: rgba(0, 0, 0, 0.85);;">添加到合集:</div>
                      <a-select default-value="lucy" style="width: 100%;margin-left: 60px;" @change="xxx">
                        <a-select-option value="jack">
                          Jack
                        </a-select-option>
                        <a-select-option value="lucy">
                          Lucy
                        </a-select-option>
                        <a-select-option value="disabled" disabled>
                          Disabled
                        </a-select-option>
                        <a-select-option value="Yiminghe">
                          yiminghe
                        </a-select-option>
                      </a-select>
                    </a-form-model-item>
                    <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" class="model-row-styl">
                      <div style="color: rgba(0, 0, 0, 0.85);;">关联位置或小程序:</div>
                      <a-radio-group v-model="form.accountNameList[tempIndex].adType" style="padding-left: 60px;">
                        <a-radio value="1">位置</a-radio>
                        <a-radio value="2">小程序</a-radio>
                      </a-radio-group>
                      <a-input v-model="tempTitle" style="margin-left: 60px;"></a-input>
                    </a-form-model-item>
                  </template>
                  <!-- 标题-->
                  <a-form-model-item
                    label="标题"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    class="model-row-styl"
                    v-if="tempPlatformId == 1"
                  >
                    <a-input v-model="tempTitle"></a-input>
                  </a-form-model-item>
                  <a-form-model-item
                    label="多标题1"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    class="model-row-styl"
                    v-if="tempPlatformId == 1"
                  >
                    <a-input v-model="tempTitle1"></a-input>
                  </a-form-model-item>
                  <a-form-model-item
                    label="多标题2"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    class="model-row-styl"
                    v-if="tempPlatformId == 1"
                  >
                    <a-input v-model="tempTitle2"></a-input>
                  </a-form-model-item>
                  <a-form-model-item
                    label="多标题3"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    class="model-row-styl"
                    v-if="tempPlatformId == 1"
                  >
                    <a-input v-model="tempTitle3"></a-input>
                  </a-form-model-item>

                  <!-- 封面-->
                  <a-form-model-item
                    label="封面"
                    class="model-row-styl"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    v-if="tempPlatformId != 19 && showPublishNewModelDirect == false"
                  >
                    <img :src="tempBanner" width="200px" />
                  </a-form-model-item>

                  <a-form-model-item
                    v-if="showPublishNewModelDirect == true"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    label="封面"
                  >
                    <j-upload
                      :number="1"
                      :multiple="false"
                      ref="imageUp"
                      v-model="tempBanner"
                      @change="coverChange1"
                    ></j-upload>
                  </a-form-model-item>

                  <a-form-model-item
                    v-if="tempPlatformId == 1"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    label="多封面1"
                  >
                    <j-upload
                      :number="1"
                      :multiple="false"
                      ref="imageUp"
                      v-model="tempBanner1"
                      @change="coverChange1"
                    ></j-upload>
                  </a-form-model-item>

                  <a-form-model-item
                    v-if="tempPlatformId == 1"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    label="多封面2"
                  >
                    <j-upload
                      :number="1"
                      :multiple="false"
                      ref="imageUp"
                      v-model="tempBanner2"
                      @change="coverChange2"
                    ></j-upload>
                  </a-form-model-item>

                  <a-form-model-item
                    v-if="tempPlatformId == 1"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    label="多封面3"
                  >
                    <j-upload
                      :number="1"
                      :multiple="false"
                      ref="imageUp"
                      v-model="tempBanner3"
                      @change="coverChange3"
                    ></j-upload>
                  </a-form-model-item>

                  <!-- 摘要-->
                  <a-form-model-item
                    label="摘要"
                    class="model-row-styl"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    v-if="tempPlatformId == 20"
                  >
                    <a-input v-model="form.accountNameList[tempIndex].desc"></a-input>
                  </a-form-model-item>
                  <!-- 留言-->
                  <a-form-model-item
                    label="留言"
                    class="model-row-styl"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    v-if="tempPlatformId == 20"
                  >
                    <a-radio-group v-model="form.accountNameList[tempIndex].needOpenComment">
                      <a-radio value="0" style="display:block">关闭留言</a-radio>
                      <a-radio value="1" style="display:block">仅关注后可留言</a-radio>
                      <a-radio value="2" style="display:block">仅关注3天及以后才可留言</a-radio>
                      <a-radio value="3" style="display:block">所有人均可留言</a-radio>
                    </a-radio-group>
                  </a-form-model-item>
                  <!-- 原文连接-->
                  <a-form-model-item
                    label="原文链接"
                    class="model-row-styl"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    v-if="tempPlatformId == 20"
                  >
                    <a-input v-model="form.accountNameList[tempIndex].contentSourceUrl"></a-input>
                  </a-form-model-item>
                  <!-- 原文连接-->
                  <a-form-model-item
                    label="合集"
                    class="model-row-styl"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    v-if="tempPlatformId == 20"
                  >
                    <!-- <a-input
                v-model="form.accountNameList[tempIndex].topicstr"
                placeholder="最多5个，英文逗号（,）隔开"
              ></a-input> -->
                    <div>
                      <template v-for="(tag, index) in tags">
                        <a-tooltip v-if="tag.length > 20" :key="tag" :title="tag">
                          <a-tag :key="tag" :closable="index !== 0" color="cyan" @close="() => handleClose(tag)">
                            {{ `${tag.slice(0, 20)}...` }}
                          </a-tag>
                        </a-tooltip>
                        <a-tag v-else :key="tag" :closable="index !== 0" color="cyan" @close="() => handleClose(tag)">
                          {{ tag }}
                        </a-tag>
                      </template>
                      <a-input
                        v-if="inputVisible"
                        ref="input"
                        type="text"
                        :style="{ width: '78px' }"
                        :value="inputValue"
                        @change="handleInputChange"
                        @blur="handleInputConfirm"
                        @keyup.enter="handleInputConfirm"
                      />
                      <a-tag v-else style="background: #fff; borderStyle: dashed;" @click="showInput">
                        <a-icon type="plus" /> 点击添加标签
                      </a-tag>
                    </div>
                  </a-form-model-item>

                  <!-- 群发地区-->
                  <!-- <a-form-model-item label="群发地区" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="tempPlatformId == 20">
              <a-select
                    ref="select"
                    v-model="form.hot"
                    placeholder="请选择热点"
                  >
                  <a-select-option v-for="(item, index ) in tempHotList" :key="index"  :value="item.title">{{item.title}}</a-select-option>
               </a-select>
            </a-form-model-item> -->

                  <!-- 群发地区-->
                  <a-form-model-item
                    label="性别"
                    :labelCol="labelCol"
                    class="model-row-styl"
                    :wrapperCol="wrapperCol"
                    v-if="tempPlatformId == 20 && form.accountNameList && form.accountNameList.length > 0"
                  >
                    <a-select ref="select" placeholder="请选择性别" v-model="form.accountNameList[tempIndex].sex">
                      <a-select-option value="0">全部</a-select-option>
                      <a-select-option value="1">男</a-select-option>
                      <a-select-option value="2">女</a-select-option>
                    </a-select>
                  </a-form-model-item>

                  <a-form-model-item
                    label="定时发布"
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    class="model-row-styl"
                    v-if="form.accountNameList && form.accountNameList.length > 0"
                  >
                    <a-date-picker
                      v-model="form.accountNameList[tempIndex].prePubTime"
                      show-time
                      format="YYYY-MM-DD HH:mm:ss"
                      placeholder="选择时间"
                      @change="handleStartOpenChange"
                    />
                  </a-form-model-item>

                  <a-form-model-item
                    label="投放广告"
                    v-if="tempPlatformId == 1 && form.accountNameList && form.accountNameList.length > 0"
                    class="model-row-styl"
                  >
                    <a-radio-group v-model="form.accountNameList[tempIndex].adType">
                      <a-radio value="2">不投放广告</a-radio>
                      <a-radio value="1">投放广告赚取收益</a-radio>
                    </a-radio-group>
                  </a-form-model-item>
                  <a-form-model-item
                    label="声明原创"
                    v-if="form.accountNameList && form.accountNameList.length > 0"
                    class="model-row-styl"
                  >
                    <a-checkbox-group v-model="form.accountNameList[tempIndex].yc">
                      <a-checkbox value="1">原创</a-checkbox>
                    </a-checkbox-group>
                  </a-form-model-item>
                  <a-form-model-item
                    label="头条首发"
                    v-if="tempPlatformId == 1 && form.accountNameList && form.accountNameList.length > 0"
                    class="model-row-styl"
                  >
                    <a-checkbox-group v-model="form.accountNameList[tempIndex].ttfirst">
                      <a-checkbox value="1">头条首发</a-checkbox>
                    </a-checkbox-group>
                    <span style="display:block;font-size:8px;color:grey;background-color: antiquewhite;"
                    >声明首发后，72小时内在站外发布相识内容将视为违规，请注意规避</span
                    >
                  </a-form-model-item>

                  <!-- 活动好友-->
                  <!-- 热点话题-->
                  <a-form-model-item
                    label=""
                    :labelCol="labelCol"
                    :wrapperCol="wrapperCol"
                    v-if="tempPlatformId == 1 && form.accountNameList && form.accountNameList.length > 0"
                    class="model-row-styl"
                  >
                    <a-tabs v-model="form.activeKey">
                      <a-tab-pane key="1" tab="参与活动">
                        <div class="tag" style="margin-top: 10px;">
                          <a-tag
                            color="orange"
                            v-for="(item, index) in tempActivityList"
                            :key="index"
                            @click="activitySelect(item)"
                          >{{ item.name }}</a-tag
                          >
                        </div>
                      </a-tab-pane>
                      <a-tab-pane key="2" tab="热点" force-render>
                        <a-select ref="select" v-model="form.accountNameList[tempIndex].hot" placeholder="请选择热点">
                          <a-select-option v-for="(item, index) in tempHotList" :key="index" :value="item.title">{{
                              item.title
                            }}</a-select-option>
                        </a-select>
                      </a-tab-pane>
                    </a-tabs>
                  </a-form-model-item>

                  <!-- 热点话题-->
                  <!-- <a-form-model-item label="" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-tabs v-model="form.activeKey">
                <a-tab-pane key="1" tab="参与话题">
                  <a-select
                    ref="select"
                    v-model="form.topic"
                    placeholder="请选择话题"
                  >
                    <a-select-option v-for="(item, index ) in tempTopicList" :key="index"  :value="item.id">{{item.title}}</a-select-option>

                  </a-select>

                </a-tab-pane>
                <a-tab-pane key="2" tab="热点" force-render>
                  <a-select
                    ref="select"
                    v-model="form.hot"
                    placeholder="请选择热点"
                  >
                  <a-select-option v-for="(item, index ) in tempHotList" :key="index"  :value="item.title">{{item.title}}</a-select-option>

                  </a-select>

                </a-tab-pane>
                <a-tab-pane key="3" tab="好友" force-render>
                  <a-select
                    ref="select"
                    mode="multiple"
                    v-model="form.friends"
                    placeholder="请选择好友"
                  >
                  <a-select-option v-for="(item, index ) in tempFriendList" :key="index"  :value="item.id">{{item.name}}</a-select-option>

                  </a-select>

                </a-tab-pane>
              </a-tabs>
            </a-form-model-item> -->
                </a-form-model>
                <!-- 发布内容 -->
                <a-input
                  v-model="wxPreviewAccount"
                  class="model-row-styl"
                  placeholder="请输入预览账号，英文逗号（,）隔开"
                  v-if="tempPlatformId == '20'"
                ></a-input>

                <a-form-model-item
                  label="是否群发"
                  :labelCol="labelCol"
                  class="model-row-styl"
                  :wrapperCol="wrapperCol"
                  v-if="tempPlatformId == 20 && form.accountNameList && form.accountNameList.length > 0"
                >
                  <a-select
                    ref="select"
                    placeholder="请选择是否群发"
                    @change="changeNotify"
                    default-value="1"
                  >
                    <a-select-option value="0">否</a-select-option>
                    <a-select-option value="1">是</a-select-option>
                  </a-select>
                </a-form-model-item>

                <a-button
                  :loading="publishing"
                  type="danger"
                  @click="priview"
                  :spinning="loading"
                  style="display:block;margin:20px auto 0;width: 50%;"
                  v-if="tempPlatformId == '1' || tempPlatformId == '20'"
                >预览
                </a-button>

                <a-button
                  :loading="publishing"
                  type="danger"
                  @click="publish11"
                  :spinning="loading"
                  style="display:block;margin:20px auto 0;width: 50%;"
                >发布
                </a-button>
              </div>
            </a-col>
          </a-row>

          <!-- 下一步按钮 -->
          <a-row style="text-align: right;" v-if="step === 0 && showPublishNewModelDirect == false">
            <a-button type="primary" @click="nextStep">
              下一步
            </a-button>
          </a-row>
          <a-row style="text-align: right;" v-if="step > 0">
            <a-button type="primary" @click="perStep">
              上一步
            </a-button>
          </a-row>
        </a-spin>
      </a-spin>
    </a-modal>
    <!-- 账号选择弹窗 -->
    <a-modal v-model="chooseModalopen" title="选择账号" width="70%" @ok="handleOk">
      <div class="idSelectDialog">
        <div class="left">
          <div
            class="platformName"
            v-for="(item, index) in accountList"
            :key="index"
            :class="{ active: index === platformIndex }"
            @click="setPlatFormIndex(index)"
          >
            <a-avatar :src="getPlatFormLogo(item.platformId)"></a-avatar>
            {{ getPlatFormName(item.platformId) }}
          </div>
        </div>
        <div class="right" v-if="accountList && accountList.length > 0">
          <a-checkbox-group v-model="accountList[platformIndex].dialogAccountNameList">
            <a-checkbox
              v-for="(accountItem, accountindex) in accountList[platformIndex].platformAccounts"
              :key="accountindex"
              :value="accountItem"
              class="accountCheckBox"
              @click="savePlatForm(accountList[platformIndex])"
            >
              <a-avatar :src="accountItem.avatar"></a-avatar>
              {{ accountItem.name }}
            </a-checkbox>
          </a-checkbox-group>
        </div>
      </div>

      <!-- 账号列表 -->
      <!-- <div class="accountList" v-for="(item, index) in accountList" :key="index">
        <div class="platformName">
          <a-avatar :src="getPlatFormLogo(item.platformId)"></a-avatar>
          {{ getPlatFormName(item.platformId) }}
        </div>
        <div class="platformAccount">
          <a-checkbox-group v-model="form.accountNameList">
            <a-checkbox
              :value="accountItem"
              v-for="(accountItem, accountindex) in item.platformAccounts"
              :key="accountindex"
              @click="savePlatForm(item)"
            >
              <a-avatar :src="accountItem.avatar"></a-avatar>
              {{ accountItem.name }}
            </a-checkbox>
          </a-checkbox-group>
        </div>
      </div> -->
    </a-modal>
  </div>

</template>

<script>
  import {JeecgListMixin} from "@/mixins/JeecgListMixin";
  import {findContentType} from "@/utils/xinkeUtil";
  import PreviewWithContentInfo from "../../components/xinke/preview/PreviewWithContentInfo";
  import ContentPublishModel from "./modules/ContentPublishModel";
  import Template1 from "../jeecg/JVxeDemo/layout-demo/Template1";
  import {postAction} from "@/api/manage";
  import PublishSetting from "@/components/xinke/PublishSetting";
  import Editor from '@/components/xinke/editor/Editor';
  import { dataArr } from '@/utils/platform'
  //内容管理列表
  export default {
    name: "ContentList",
    components: {PublishSetting, Template1, ContentPublishModel, PreviewWithContentInfo, Editor},
    mixins: [JeecgListMixin],
    data() {
      return {
        defaultImg: require('@assets/default.png'),
        url: {
          list: 'content/contentInfo/myContentList'
        },
        showDetail: false,
        showPrint: false,
        currentItem: null,
        showPublishModel: false,
        syncing: false,
        publishing: false,
        currentIndex: -1,
        delDataSource: [],
        visible: false,
        delColumns: [
          {
            title: '标题',
            dataIndex: 'contentTitle',
            align: "center",
          },{
            title: '操作',
            dataIndex: 'action',
            scopedSlots: {customRender: 'action'},
            align: "center",
            width:'170px'
          }
        ],
        columns: [
          // {
          //   title: '封面',
          //   dataIndex: 'img',
          //   align: "center",
          //   scopedSlots: {customRender: 'img'},
          //   width:'200px'
          // },
          {
            title: '标题',
            dataIndex: 'contentTitle',
            align: "center",
          },
          {
            title: '副标题',
            dataIndex: 'contentSubTitle',
            align: "center",
            customRender(text, r, index) {
              return text || '暂无副标题'
            }
          },
          {
            title: '简介',
            dataIndex: 'contentIntroduce',
            align: "center",
            scopedSlots: {customRender: 'contentIntroduce'},
          },

          {
            title: '创建时间',
            dataIndex: 'createTime',
            align: "center",
          },
          {
            title: '操作',
            dataIndex: 'action',
            scopedSlots: {customRender: 'action'},
            align: "center",
            width:'570px'
          }
        ],
        columns2: [
          {
            title: '标题',
            align: 'left',
            dataIndex: 'contentTitle',
            width: '450px',
            ellipsis: true
          },

          {
            title: '发布者',
            align: 'center',
            dataIndex: 'authorName'
          },
          {
            title: '发布时间',
            align: 'center',
            dataIndex: 'createTime'
          }
        ],
        // ipagination: {
        //   current: 1,
        // },
        showPublishNewModel: false,
        showPublishNewModelDirect: false,
        spinDown: false,
        spinDetail: '视频下载中...',
        step: 0,
        previewloading: false,
        selectedRows: [],
        selectedRowKeys: [],
        selectedRowsIndex: 0,
        tempTitle: '',
        tempTitle1: '',
        tempTitle2: '',
        tempTitle3: '',
        tempBanner: '',
        tempBanner1: '',
        tempBanner2: '',
        tempBanner3: '',
        platformSelected: [],
        dataArrNew: null,
        form: {
          activeKey: '1'
        },
        chooseModalopen: false,
        tempPlatformId: '',
        rules: {
          account: [
            // eslint-disable-next-line standard/object-curly-even-spacing
            { required: true, message: '请选择账号', trigger: ['change'] }
          ],
          topic: [{ required: true, message: '请输入标题', trigger: ['change'] }],
          banner: [{ required: true, message: '封面不能为空', trigger: ['change'] }],
          title: [
            // eslint-disable-next-line standard/object-curly-even-spacing
            { required: true, message: '标题字数不能少于5个，不能多于30个', trigger: 'blur' }
          ]
        },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 4 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 18 }
        },
        inputVisible: false,
        inputValue: '',
        tags: [],
        tempFriendList: [],
        tempHotList: [],
        tempActivityList: [],
        wxPreviewAccount: '',
        accountList: [],
        platformIndex: 0,
      }
    },
    mounted() {
      this.icondataAll = dataArr.filter(item => item.functions.length === 2)
      this.icondataAccount = dataArr.filter(item => item.functions.length === 1)
      this.dataArrNew = dataArr
    },
    watch: {
      selectedRowsIndex: {
        // 执行方法

        handler(newValue, oldVal) {
          if (this.showPublishNewModelDirect == false) {
            this.tempTitle = this.selectedRows[newValue].contentTitle
            this.tempBanner = this.selectedRows[newValue].mbLogoUrl
          }
        },
        immediate: true // 第一次改变就执行
      },
      tempTitle: {
        handler(newValue, oldVal) {
          if (this.showPublishNewModelDirect == false) {
            let obj = this.selectedRows[this.selectedRowsIndex]
            obj.contentTitle = newValue
            this.$set(this.selectedRows, this.selectedRowsIndex, obj)
          }
        },
        immediate: true // 第一次改变就执行
      }
    },
    methods: {
      publishTonew() {
        this.showPublishNewModel = true
      },
      closePublish() {
        this.showPublishNewModel = false
        this.showPublishNewModelDirect = false
        this.queryParam.contentTitle = ''
        this.tabChange(this.tabKey)
      },
      tabChange1(activeKey) {
        this.tabKey = activeKey
        if (activeKey === 'mine') {
          this.url.list = 'content/contentInfo/myContentList'
        } else if (activeKey === 'all') {
          // 待定
          this.url.list = '/content/contentInfo/list'
        } else {
          this.url.list = '/content/contentInfo/selfMediaList'
        }
        // this.queryParam.contentType = '1,2,3'
        this.loadData(1)
      },
      deleteSelectRow(index) {
        if (this.selectedRows && this.selectedRows.length > 1) {
          this.selectedRows.splice(index, 1)
          this.selectedRowsIndex = 0
        } else if (this.selectedRows && this.selectedRows.length === 1) {
          this.selectedRows = []
          this.selectedRowsIndex = 0
          this.step--
        }
        console.log(this.selectedRowKeys, 'this.selectedRowKeys', this.selectedRows)
        this.selectedRowKeys = this.selectedRows.map(item => {
          return item.contentNo
        })
      },
      perStep() {
        this.step--
      },
      handerEditorCont(v) {
        this.tempContent = v
      },
      getPlatFormLogo(id) {
        for (let i = 0; i < this.dataArrNew.length; i++) {
          if (this.dataArrNew[i].id == id) {
            return this.dataArrNew[i].logo
          }
        }
      },
      changeSelectedPlatform(platformId) {
        let that = this
        this.form.accountNameListSelected = []
        for (var y = 0; y < this.form.accountNameList.length; y++) {
          if (this.form.accountNameList[y].platformId == platformId) {
            // this.$nextTick(function(){
            that.form.accountNameListSelected.push(this.form.accountNameList[y])

            // })
          }
        }
        this.tempPlatformId = platformId

        this.chooseModalopen = true
        this.chooseModalopen = false
        console.log(this.form.accountNameListSelected, platformId, 'platformId')
      },
      getHot(item, index) {
        //记录当前选的账号位置
        this.tempIndex = index
        // this.form.accountNameList[this.tempIndex].notifySubscribers  = '1'

        console.log(this.form.accountNameList[this.tempIndex])
        this.tempPlatformId = this.form.accountNameList[this.tempIndex].platformId
        console.log(this.tempIndex)
        //获取话题和热点数据
        const params = {
          platformId: item.platformId,
          platformAccountCookie: item.cookie,
          platformAccountToken: null,
          platformAccountId: item.id,
          mediaTypeEnum: this.queryParam.contentType,
          dataType: 2, // 1好友 2话题 3热点
          keyWord: null // 搜索关键词
        }
        console.log(params)

        this.socket.emit('get-mediaTopicInfo', JSON.stringify(params), response => {
          const result = JSON.parse(response)
          console.log('获取好友/话题/热点', result)
          this.tempTopicList = result.dataBody
        })
        const params2 = {
          platformId: item.platformId,
          platformAccountCookie: item.cookie,
          platformAccountToken: null,
          platformAccountId: item.id,
          mediaTypeEnum: this.queryParam.contentType,
          dataType: 3, // 1好友 2话题 3热点
          keyWord: null // 搜索关键词
        }
        console.log(params2)
        this.socket.emit('get-mediaTopicInfo', JSON.stringify(params2), response => {
          const result = JSON.parse(response)
          console.log('获取好友/话题/热点', result)
          this.tempHotList = result.dataBody
        })

        const params3 = {
          platformId: item.platformId,
          platformAccountCookie: item.cookie,
          platformAccountToken: null,
          platformAccountId: item.id,
          mediaTypeEnum: this.queryParam.contentType,
          dataType: 1, // 1好友 2话题 3热点
          keyWord: null // 搜索关键词
        }
        console.log(params3)
        this.socket.emit('get-mediaTopicInfo', JSON.stringify(params3), response => {
          const result = JSON.parse(response)
          console.log('获取好友/话题/热点', result)
          this.tempFriendList = result.dataBody
        })

        //获取活动
        const params4 = {
          platformId: item.platformId,
          platformAccountCookie: item.cookie,
          platformAccountToken: null,
          platformAccountId: item.id,
          mediaTypeEnum: this.queryParam.contentType
        }

        this.socket.emit('get-activity-list', JSON.stringify(params4), response => {
          const result = JSON.parse(response)
          this.tempActivityList = result.dataBody
        })
      },
      handleClose(removedTag) {
        const tags = this.tags.filter(tag => tag !== removedTag)
        console.log(tags)
        this.tags = tags
      },
      addAccountModalShow() {
        // this.initAccountList()

        this.chooseModalopen = true
      },
      handleInputChange(e) {
        this.inputValue = e.target.value
      },
      handleInputConfirm() {
        const inputValue = this.inputValue
        let tags = this.tags
        if (inputValue && tags.indexOf(inputValue) === -1) {
          tags = [...tags, inputValue]
        }
        console.log(tags)
        Object.assign(this, {
          tags,
          inputVisible: false,
          inputValue: ''
        })
      },
      showInput() {
        this.inputVisible = true
        this.$nextTick(function() {
          this.$refs.input.focus()
        })
      },
      coverChange1(path, item) {
        this.tempBanner1 = item.file.response.result.url
      },
      coverChange2(path, item) {
        this.tempBanner2 = item.file.response.result.url
      },
      coverChange3(path, item) {
        this.tempBanner3 = item.file.response.result.url
      },
      handleStartOpenChange(e, t) {
        this.form.startTime = t
      },
      activitySelect(item) {
        this.form.accountNameList[this.tempIndex].activityId = item.id
        this.form.accountNameList[this.tempIndex].activityName = item.name
      },
      publish11() {
        if (!this.socket.connected) {
          this.$message.warning('客户端连接失败，请检查配置！')
          return
        } else {
          const ruleFlag = this.checkRule()
          if (!ruleFlag) return false
          this.loading = true

          if (this.showPublishNewModelDirect == true) {
            let tempData = {
              contentType: '1',
              contentTitle: this.tempTitle,
              content: this.tempContent,
              mbLogoUrl: this.tempBanner
            }
            this.selectedRows.push(tempData)
          }

          if (this.selectedRows[0].contentType == '1') {
            for (let i = 0; i < this.selectedRows.length; i++) {
              var publishData = {}

              console.log(this.selectedRows[i])
              publishData.title = this.selectedRows[i].contentTitle
              publishData.content = this.selectedRows[i].content
              console.log(publishData)
              publishData.mediaContentType = 'Article'
              publishData.merchantToken = this.merchantToken
              var jPlatforms = []
              for (let j = 0; j < this.form.accountNameList.length; j++) {
                var jPlatform = {}
                var contentList = {}
                var contentLists = []
                jPlatform.platformAccountId = this.form.accountNameList[j].id
                jPlatform.title = this.selectedRows[i].contentTitle
                jPlatform.platformId = Number(this.form.accountNameList[j].platformId)
                if (this.form.accountNameList[j].cookie == null || this.form.accountNameList[j].cookie == '') {
                  this.$message.warning(
                    this.getPlatFormName(this.form.accountNameList[j].platformId) +
                    '账号：' +
                    this.form.accountNameList[j].id +
                    '登录过期，请前往账号管理重新登录'
                  )
                  return
                }

                var _cookie = JSON.parse(this.form.accountNameList[j].cookie)
                jPlatform.covers = [this.selectedRows[i].mbLogoUrl]
                if (this.form.accountNameList[j].notifySubscribers != null) {
                  jPlatform.notifySubscribers = this.form.accountNameList[j].notifySubscribers
                }else{
                  jPlatform.notifySubscribers = '1'
                }
                //设置头条/抖音
                if (this.tempPlatformId == 1) {
                  if (this.form.accountNameList[j].prePubTime != null) {
                    jPlatform.prePubTime = this.form.accountNameList[j].prePubTime.format('YYYY-MM-DD HH:mm:ss')
                  }
                  if (this.form.accountNameList[j].hot != null) {
                    jPlatform.hotSentence = this.form.accountNameList[j].hot
                  }
                  if (this.form.accountNameList[j].yc != null) {
                    jPlatform.isOriginal = 1
                  } else {
                    jPlatform.isOriginal = 0
                  }

                  if (this.form.accountNameList[j].activityId != null) {
                    jPlatform.activityId = this.form.accountNameList[j].activityId
                    jPlatform.activityName = this.form.accountNameList[j].activityName
                  }
                  if (this.form.accountNameList[j].adType != null) {
                    jPlatform.adType = this.form.accountNameList[j].adType
                  }
                  var multiTitles = []
                  multiTitles.push(this.selectedRows[i].contentTitle)
                  if ((this.tempTitle1 != null) & (this.tempTitle1 != '')) {
                    multiTitles.push(this.tempTitle1)
                  }
                  if ((this.tempTitle2 != null) & (this.tempTitle2 != '')) {
                    multiTitles.push(this.tempTitle2)
                  }
                  if ((this.tempTitle3 != null) & (this.tempTitle3 != '')) {
                    multiTitles.push(this.tempTitle3)
                  }
                  jPlatform.multiTitles = multiTitles

                  if ((this.tempBanner1 != null) & (this.tempBanner1 != '')) {
                    jPlatform.covers.push(this.tempBanner1)
                  }
                  if ((this.tempBanner2 != null) & (this.tempBanner2 != '')) {
                    jPlatform.covers.push(this.tempBanner2)
                  }
                  if ((this.tempBanner3 != null) & (this.tempBanner3 != '')) {
                    jPlatform.covers.push(this.tempBanner3)
                  }
                }

                //微信独有
                contentList.title = this.selectedRows[i].contentTitle
                contentList.author = ' '
                contentList.content = this.selectedRows[i].content
                contentList.coverPathOrUrl = this.selectedRows[i].mbLogoUrl
                contentList.desc = this.selectedRows[i].contentTitle
                if (this.form.accountNameList[j].notifySubscribers != null) {
                  contentList.notifySubscribers = Number(this.form.accountNameList[j].notifySubscribers)
                }else{
                  contentList.notifySubscribers = 1
                }
                if (this.form.accountNameList[j].needOpenComment != null) {
                  contentList.needOpenComment = this.form.accountNameList[j].needOpenComment
                }
                if (this.form.accountNameList[j].desc != null) {
                  contentList.desc = this.form.accountNameList[j].desc
                }
                if (this.form.accountNameList[j].contentSourceUrl != null) {
                  contentList.contentSourceUrl = this.form.accountNameList[j].contentSourceUrl
                }
                if (this.form.accountNameList[j].yc != null) {
                  contentList.isOriginal = 1
                } else {
                  contentList.isOriginal = 0
                }

                contentList.topics = this.tags

                contentLists.push(contentList)
                // jPlatform.isOriginal = 0

                // var _cookie = [{"name":"gfgarrcache_29674012","value":"1","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4/","secure":false,"httpOnly":false,"session":false,"expirationDate":1691455086.957832,"sameSite":"unspecified"},{"name":"gfgarrcache_bfc6c4e5","value":"1","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4/","secure":false,"httpOnly":false,"session":false,"expirationDate":1691455124.909919,"sameSite":"unspecified"},{"name":"x-jupiter-uuid","value":"16908502688897366","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4","secure":false,"httpOnly":true,"session":false,"expirationDate":1691455085.414464,"sameSite":"unspecified"},{"name":"passport_csrf_token","value":"ae2822695ab8484cc64cb66e46f94c33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":false,"session":false,"expirationDate":1696034287.851719,"sameSite":"no_restriction"},{"name":"passport_csrf_token_default","value":"ae2822695ab8484cc64cb66e46f94c33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1696034287.851747,"sameSite":"unspecified"},{"name":"s_v_web_id","value":"verify_lkrklua0_AedKsl2T_Jsjz_4hDR_8VXu_1txNLyoK7GYo","domain":"mp.toutiao.com","hostOnly":true,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1696034290,"sameSite":"unspecified"},{"name":"_ba","value":"BA0.2-20230801-5110e-x0PAli3vNyHRWI4z9GxU","domain":".mp.toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1753922290,"sameSite":"unspecified"},{"name":"ttwid","value":"1%7CC8Rf4-tl54oVhKQqm_ZYkOwvmLq3l7XKhwqKr_gfjRk%7C1690850274%7Cb057f77359aa43230cd6ffe598a7931c4a03b6e289423f95dc02f0d8b0bda302","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1722386291.251357,"sameSite":"no_restriction"},{"name":"d_ticket","value":"cc2701a786149588d6bd41541db22f443bb33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.517699,"sameSite":"unspecified"},{"name":"n_mh","value":"SQMIVkn0ZI3dBLrve6IKic_UJ7rK0bsMaYj6timX0J8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1701218323.517783,"sameSite":"unspecified"},{"name":"sso_auth_status","value":"eab125aae2060614dc2d28ba70118602","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1693442323.51785,"sameSite":"unspecified"},{"name":"sso_auth_status_ss","value":"eab125aae2060614dc2d28ba70118602","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1693442323.517871,"sameSite":"no_restriction"},{"name":"sso_uid_tt","value":"e07be974bcbde5d103843354fb7d70af","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034323.517893,"sameSite":"unspecified"},{"name":"sso_uid_tt_ss","value":"e07be974bcbde5d103843354fb7d70af","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517927,"sameSite":"no_restriction"},{"name":"toutiao_sso_user","value":"6c7234f2d3e520de00e4fb92db67df13","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034323.517953,"sameSite":"unspecified"},{"name":"toutiao_sso_user_ss","value":"6c7234f2d3e520de00e4fb92db67df13","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517972,"sameSite":"no_restriction"},{"name":"sid_ucp_sso_v1","value":"1.0.0-KDU4NjQ1YzFjZmExNWI5MmUxYjE0OWU1N2ZjZjY1Y2ZjYjIxZDI2NWUKHwit0qCMs4zZARCCqKGmBhjPCSAMMPewzJEGOAJA8QcaAmxmIiA2YzcyMzRmMmQzZTUyMGRlMDBlNGZiOTJkYjY3ZGYxMw","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517992,"sameSite":"unspecified"},{"name":"ssid_ucp_sso_v1","value":"1.0.0-KDU4NjQ1YzFjZmExNWI5MmUxYjE0OWU1N2ZjZjY1Y2ZjYjIxZDI2NWUKHwit0qCMs4zZARCCqKGmBhjPCSAMMPewzJEGOAJA8QcaAmxmIiA2YzcyMzRmMmQzZTUyMGRlMDBlNGZiOTJkYjY3ZGYxMw","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.518013,"sameSite":"no_restriction"},{"name":"odin_tt","value":"6a3ff1a232ff32ff4cc8b3cdd74e9cf4b81d1495b86fea9960746a30bd490e76f43667fbe2a4eb0a5c7035cd220dfa719aacdc2c97ed86cb2b88ddf6c8d46cfd","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.758879,"sameSite":"unspecified"},{"name":"passport_auth_status","value":"3fe4e38ca97fc61b48199b00dd246f9e%2C42b61cf9a976c609e0b9a57e7d3d1e6e","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1693442323.758967,"sameSite":"unspecified"},{"name":"passport_auth_status_ss","value":"3fe4e38ca97fc61b48199b00dd246f9e%2C42b61cf9a976c609e0b9a57e7d3d1e6e","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1693442323.759,"sameSite":"no_restriction"},{"name":"sid_guard","value":"ba1f1e87af17351b13165b03404b3fc8%7C1690850307%7C5184001%7CSat%2C+30-Sep-2023+00%3A38%3A28+GMT","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1721954323.759038,"sameSite":"unspecified"},{"name":"uid_tt","value":"e08b69b3c3ff62fb2dbdf586760ede71","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759068,"sameSite":"unspecified"},{"name":"uid_tt_ss","value":"e08b69b3c3ff62fb2dbdf586760ede71","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759095,"sameSite":"no_restriction"},{"name":"sid_tt","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759123,"sameSite":"unspecified"},{"name":"sessionid","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759148,"sameSite":"unspecified"},{"name":"sessionid_ss","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759173,"sameSite":"no_restriction"},{"name":"sid_ucp_v1","value":"1.0.0-KGMxYTBkNDJjYTRiZjQ2ODg4ZWQ0NzEwMTlkYjJhZmM5ZDAwMzZiYjMKGQit0qCMs4zZARCDqKGmBhjPCSAMOAJA8QcaAmxmIiBiYTFmMWU4N2FmMTczNTFiMTMxNjViMDM0MDRiM2ZjOA","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.7592,"sameSite":"unspecified"},{"name":"ssid_ucp_v1","value":"1.0.0-KGMxYTBkNDJjYTRiZjQ2ODg4ZWQ0NzEwMTlkYjJhZmM5ZDAwMzZiYjMKGQit0qCMs4zZARCDqKGmBhjPCSAMOAJA8QcaAmxmIiBiYTFmMWU4N2FmMTczNTFiMTMxNjViMDM0MDRiM2ZjOA","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759234,"sameSite":"no_restriction"},{"name":"store-region","value":"cn-js","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.759259,"sameSite":"unspecified"},{"name":"store-region-src","value":"uid","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.759281,"sameSite":"unspecified"},{"name":"csrf_session_id","value":"24f87f3a3c4daff0c1c7bebb51de9eb3","domain":"mp.toutiao.com","hostOnly":true,"path":"/","secure":true,"httpOnly":false,"session":true,"sameSite":"no_restriction"}]
                jPlatform.cookie = JSON.stringify(_cookie)
                jPlatform.desc = this.selectedRows[i].contentTitle
                // jPlatform.tags = null
                jPlatform.taskId = this.uuid()
                jPlatform.token = null
                jPlatform.contentList = []
                ;(jPlatform.authorId = ' '), // 必填
                  (jPlatform.authorName = ' ') // 必填
                jPlatform.contentList = contentLists

                //

                jPlatforms.push(jPlatform)
              }
              // console.log(jPlatforms)
              publishData.jPlatforms = jPlatforms
              // console.log(JSON.stringify(publishData))
              //todo 点击发布时 查询是否可以发布，有没有重复数据
              var tempParam = {}
              tempParam.accountId = jPlatform.platformAccountId
              tempParam.contentId = this.selectedRows[i].contentNo

              console.log(publishData, 'publishData')
              let warnArr = []
              let showCode = false
              this.socket.emit('publish', JSON.stringify(publishData), response => {
                // console.log(JSON.parse(response))
              })

              this.socket.on('publish-progress', data => {
                // console.log(JSON.parse(data))
                if (JSON.parse(data).code == -1) {
                  const mes = JSON.parse(data).message
                  if (warnArr.indexOf(mes) === -1) {
                    warnArr.push(mes)
                    // this.$message.warning(JSON.parse(data).message)
                  }
                }
                // this.$message.warning(JSON.parse(data).message)
                // this.process = JSON.parse(data).data.progress
                this.processFlag = true
                for (var i = 0; i < this.form.accountNameList.length; i++) {
                  // console.log(JSON.parse(data).platformAccountId)
                  // console.log(this.form.accountNameList[i].id)
                  if (JSON.parse(data).platformAccountId == this.form.accountNameList[i].id) {
                    this.processFlag = false
                    this.form.accountNameList[i].process = JSON.parse(data).data.progress
                    this.form.accountNameList[i].text = JSON.parse(data).message
                    console.log(this.form.accountNameList, 'this.form.accountNameList-publish')
                    this.processFlag = true

                    // console.log(this.form.accountNameList[i].text)
                  }
                }

                if (JSON.parse(data).message == '同步成功') {
                  //todo 发布成功后 插入自己数据库 内容id，平台id，平台账号，时间
                  // var tempParam = {}
                  // tempParam.contentNo = this.selectedRows[i].contentNo
                  // tempParam.platformId = JSON.parse(data).platformId
                  // tempParam.accountId = JSON.parse(data).platformAccountId
                  // tempParam.type = '1'
                  // console.log(tempParam)
                  // postAction('/acount/third/publishRecord', tempParam).then(res => {
                  //   if (res.success) {
                  //     this.$message.success("发布成功")
                  //     this.showPublishNewModel = false
                  //   }
                  // })
                }

                if (JSON.parse(data).message == '返回微信二维码') {
                  this.qrcodeUrl = JSON.parse(data).data.qrCodeUrl
                  // this.$nextTick(() => {
                  //   that.crateQrcode(this.qrcodeUrl)
                  // })
                  this.qrcodeShow = true
                }
              })

              this.socket.on('publish-status', data => {
                // console.log(JSON.parse(data))
                if (JSON.parse(data).code == -1) {
                  // this.$message.warning(JSON.parse(data).message)
                  for (var i = 0; i < this.form.accountNameList.length; i++) {
                    if (JSON.parse(data).platformAccountId == this.form.accountNameList[i].id) {
                      this.processFlag = false
                      this.form.accountNameList[i].process = 50
                      this.form.accountNameList[i].text = JSON.parse(data).message
                      this.processFlag = true

                      console.log(this.form.accountNameList[i].text)
                    }
                  }
                }
                if (JSON.parse(data).code == 200) {
                  var tempParam = {}
                  // console.log(i)
                  // tempParam.contentNo = this.selectedRows[i].contentNo
                  tempParam.platformId = JSON.parse(data).platformId
                  tempParam.accountId = JSON.parse(data).platformAccountId
                  tempParam.type = '1'
                  tempParam.publishId = JSON.parse(data).data.publishId
                  console.log(tempParam)
                  postAction('/acount/third/publishRecord', tempParam).then(res => {
                    if (res.success) {
                      this.$message.success('发布成功')
                      this.showPublishNewModel = false
                      // window.location.reload()
                      this.qrcodeShow = false
                      // this.resetData()
                      this.processFlag = false
                    }
                  })
                }
              })
              //   }
              // })
            }
          } else if (this.selectedRows[0].contentType == '2' || this.selectedRows[0].contentType == '3') {
            let isZz = false
            for (let i = 0; i < this.selectedRows.length; i++) {
              //先处理地址
              this.socket.emit('down-video', JSON.stringify(this.selectedRows[i].videoUrl), () => {})
              this.spinDown = true
              this.socket.on('down-video', response => {
                const result = JSON.parse(response)
                console.log('视频', result)
                if (result.messageType == 200 && result.process == 1) {
                  // var tempParam = {}
                  //   tempParam.url = result.path
                  // postAction('/acount/third/transferUrl', tempParam).then(res => {
                  // if (res.success) {
                  this.spinDown = false

                  this.tempVideoUrl = result.path
                  var publishData = {}
                  publishData.title = this.selectedRows[i].contentTitle
                  publishData.content = this.selectedRows[i].contentTitle
                  publishData.filePathOrUrl = this.tempVideoUrl
                  if (this.tabKey == '2') {
                    publishData.mediaContentType = 'Video'
                  } else {
                    publishData.mediaContentType = 'MiniVideo'
                  }
                  // publishData.mediaContentType  = "Video"

                  publishData.merchantToken = this.merchantToken
                  var jPlatforms = []
                  for (let j = 0; j < this.form.accountNameList.length; j++) {
                    var jPlatform = {}
                    jPlatform.platformAccountId = this.form.accountNameList[j].id
                    jPlatform.title = this.selectedRows[i].contentTitle
                    jPlatform.platformId = this.form.accountNameList[j].platformId
                    if (this.form.accountNameList[j].cookie == null || this.form.accountNameList[j].cookie == '') {
                      this.$message.warning(
                        this.getPlatFormName(this.form.accountNameList[j].platformId) +
                        '账号：' +
                        this.form.accountNameList[j].id +
                        '登录过期，请前往账号管理重新登录'
                      )
                      return
                    }
                    jPlatform.isOriginal = 1
                    // jPlatform.allownDownload = '1',
                    ;(jPlatform.visibilityType = 1),
                      // console.log(this.form.accountNameList[j].cookie)
                      (_cookie = JSON.parse(this.form.accountNameList[j].cookie))

                    jPlatform.covers = [this.selectedRows[i].mbLogoUrl]
                    // jPlatform.isOriginal = 0

                    // var _cookie = [{"name":"gfgarrcache_29674012","value":"1","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4/","secure":false,"httpOnly":false,"session":false,"expirationDate":1691455086.957832,"sameSite":"unspecified"},{"name":"gfgarrcache_bfc6c4e5","value":"1","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4/","secure":false,"httpOnly":false,"session":false,"expirationDate":1691455124.909919,"sameSite":"unspecified"},{"name":"x-jupiter-uuid","value":"16908502688897366","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4","secure":false,"httpOnly":true,"session":false,"expirationDate":1691455085.414464,"sameSite":"unspecified"},{"name":"passport_csrf_token","value":"ae2822695ab8484cc64cb66e46f94c33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":false,"session":false,"expirationDate":1696034287.851719,"sameSite":"no_restriction"},{"name":"passport_csrf_token_default","value":"ae2822695ab8484cc64cb66e46f94c33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1696034287.851747,"sameSite":"unspecified"},{"name":"s_v_web_id","value":"verify_lkrklua0_AedKsl2T_Jsjz_4hDR_8VXu_1txNLyoK7GYo","domain":"mp.toutiao.com","hostOnly":true,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1696034290,"sameSite":"unspecified"},{"name":"_ba","value":"BA0.2-20230801-5110e-x0PAli3vNyHRWI4z9GxU","domain":".mp.toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1753922290,"sameSite":"unspecified"},{"name":"ttwid","value":"1%7CC8Rf4-tl54oVhKQqm_ZYkOwvmLq3l7XKhwqKr_gfjRk%7C1690850274%7Cb057f77359aa43230cd6ffe598a7931c4a03b6e289423f95dc02f0d8b0bda302","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1722386291.251357,"sameSite":"no_restriction"},{"name":"d_ticket","value":"cc2701a786149588d6bd41541db22f443bb33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.517699,"sameSite":"unspecified"},{"name":"n_mh","value":"SQMIVkn0ZI3dBLrve6IKic_UJ7rK0bsMaYj6timX0J8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1701218323.517783,"sameSite":"unspecified"},{"name":"sso_auth_status","value":"eab125aae2060614dc2d28ba70118602","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1693442323.51785,"sameSite":"unspecified"},{"name":"sso_auth_status_ss","value":"eab125aae2060614dc2d28ba70118602","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1693442323.517871,"sameSite":"no_restriction"},{"name":"sso_uid_tt","value":"e07be974bcbde5d103843354fb7d70af","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034323.517893,"sameSite":"unspecified"},{"name":"sso_uid_tt_ss","value":"e07be974bcbde5d103843354fb7d70af","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517927,"sameSite":"no_restriction"},{"name":"toutiao_sso_user","value":"6c7234f2d3e520de00e4fb92db67df13","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034323.517953,"sameSite":"unspecified"},{"name":"toutiao_sso_user_ss","value":"6c7234f2d3e520de00e4fb92db67df13","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517972,"sameSite":"no_restriction"},{"name":"sid_ucp_sso_v1","value":"1.0.0-KDU4NjQ1YzFjZmExNWI5MmUxYjE0OWU1N2ZjZjY1Y2ZjYjIxZDI2NWUKHwit0qCMs4zZARCCqKGmBhjPCSAMMPewzJEGOAJA8QcaAmxmIiA2YzcyMzRmMmQzZTUyMGRlMDBlNGZiOTJkYjY3ZGYxMw","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517992,"sameSite":"unspecified"},{"name":"ssid_ucp_sso_v1","value":"1.0.0-KDU4NjQ1YzFjZmExNWI5MmUxYjE0OWU1N2ZjZjY1Y2ZjYjIxZDI2NWUKHwit0qCMs4zZARCCqKGmBhjPCSAMMPewzJEGOAJA8QcaAmxmIiA2YzcyMzRmMmQzZTUyMGRlMDBlNGZiOTJkYjY3ZGYxMw","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.518013,"sameSite":"no_restriction"},{"name":"odin_tt","value":"6a3ff1a232ff32ff4cc8b3cdd74e9cf4b81d1495b86fea9960746a30bd490e76f43667fbe2a4eb0a5c7035cd220dfa719aacdc2c97ed86cb2b88ddf6c8d46cfd","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.758879,"sameSite":"unspecified"},{"name":"passport_auth_status","value":"3fe4e38ca97fc61b48199b00dd246f9e%2C42b61cf9a976c609e0b9a57e7d3d1e6e","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1693442323.758967,"sameSite":"unspecified"},{"name":"passport_auth_status_ss","value":"3fe4e38ca97fc61b48199b00dd246f9e%2C42b61cf9a976c609e0b9a57e7d3d1e6e","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1693442323.759,"sameSite":"no_restriction"},{"name":"sid_guard","value":"ba1f1e87af17351b13165b03404b3fc8%7C1690850307%7C5184001%7CSat%2C+30-Sep-2023+00%3A38%3A28+GMT","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1721954323.759038,"sameSite":"unspecified"},{"name":"uid_tt","value":"e08b69b3c3ff62fb2dbdf586760ede71","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759068,"sameSite":"unspecified"},{"name":"uid_tt_ss","value":"e08b69b3c3ff62fb2dbdf586760ede71","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759095,"sameSite":"no_restriction"},{"name":"sid_tt","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759123,"sameSite":"unspecified"},{"name":"sessionid","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759148,"sameSite":"unspecified"},{"name":"sessionid_ss","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759173,"sameSite":"no_restriction"},{"name":"sid_ucp_v1","value":"1.0.0-KGMxYTBkNDJjYTRiZjQ2ODg4ZWQ0NzEwMTlkYjJhZmM5ZDAwMzZiYjMKGQit0qCMs4zZARCDqKGmBhjPCSAMOAJA8QcaAmxmIiBiYTFmMWU4N2FmMTczNTFiMTMxNjViMDM0MDRiM2ZjOA","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.7592,"sameSite":"unspecified"},{"name":"ssid_ucp_v1","value":"1.0.0-KGMxYTBkNDJjYTRiZjQ2ODg4ZWQ0NzEwMTlkYjJhZmM5ZDAwMzZiYjMKGQit0qCMs4zZARCDqKGmBhjPCSAMOAJA8QcaAmxmIiBiYTFmMWU4N2FmMTczNTFiMTMxNjViMDM0MDRiM2ZjOA","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759234,"sameSite":"no_restriction"},{"name":"store-region","value":"cn-js","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.759259,"sameSite":"unspecified"},{"name":"store-region-src","value":"uid","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.759281,"sameSite":"unspecified"},{"name":"csrf_session_id","value":"24f87f3a3c4daff0c1c7bebb51de9eb3","domain":"mp.toutiao.com","hostOnly":true,"path":"/","secure":true,"httpOnly":false,"session":true,"sameSite":"no_restriction"}]
                    jPlatform.cookie = JSON.stringify(_cookie)
                    jPlatform.desc = this.selectedRows[i].contentTitle
                    // jPlatform.tags = null
                    jPlatform.taskId = this.uuid()
                    jPlatform.token = null
                    jPlatform.contentList = []
                    ;(jPlatform.authorId = ' '), // 必填
                      (jPlatform.authorName = ' ') // 必填
                    jPlatforms.push(jPlatform)
                  }
                  publishData.jPlatforms = jPlatforms
                  console.log(publishData)

                  // console.log(JSON.stringify(publishData))
                  //todo 点击发布时 查询是否可以发布，有没有重复数据
                  var tempParam = {}
                  tempParam.accountId = jPlatform.platformAccountId
                  tempParam.contentId = this.selectedRows[i].contentNo
                  tempParam.type = this.queryParam.contentType

                  postAction('/acount/third/checkPublishRecord', tempParam).then(res => {
                    if (res.result > 0) {
                      this.$message.warning(this.selectedRows[i].contentTitle + '已发布至该平台请检查')
                      this.showPublishNewModel = false
                      flag = false
                    } else {
                      // alert(111)
                      this.socket.emit('publish', JSON.stringify(publishData), response => {
                        console.log(JSON.parse(response))
                      })

                      this.socket.on('publish-progress', data => {
                        console.log(JSON.parse(data))
                        // this.$message.warning(JSON.parse(data).message)
                        this.processFlag = true
                        this.process = JSON.parse(data).data.progress
                      })

                      this.socket.on('publish-status', data => {
                        this.processFlag = true
                        console.log(JSON.parse(data))
                        if (JSON.parse(data).code == 200) {
                          var tempParam = {}
                          tempParam.contentNo = this.selectedRows[i].contentNo
                          tempParam.platformId = JSON.parse(data).platformId
                          tempParam.accountId = JSON.parse(data).platformAccountId
                          tempParam.type = this.selectedRows[0].contentType
                          tempParam.publishId = JSON.parse(data).data.publishId
                          console.log(tempParam)
                          postAction('/acount/third/publishRecord', tempParam).then(res => {
                            if (res.success) {
                              this.$message.success('发布成功')
                              this.showPublishNewModel = false
                              // aaaa
                              this.resetData()
                            }
                          })
                        }
                      })
                    }
                  })
                  // }
                  // })
                } else {
                  if (!isZz) {
                    // this.$message.warning('视频转载中')
                    isZz = true
                  }
                  // this.$message.warning('视频转载中')
                }
                if (result.messageType === -1) {
                  this.spinDown = false
                }
              })
            }
          } else if (this.selectedRows[0].contentType == '4') {
            for (let i = 0; i < this.selectedRows.length; i++) {
              var publishData = {}
              publishData.title = this.selectedRows[i].contentTitle
              publishData.content = this.selectedRows[i].htmlUrl
              publishData.mediaContentType = 'MicroArticle'
              publishData.merchantToken = this.merchantToken
              var jPlatforms = []
              for (let j = 0; j < this.form.accountNameList.length; j++) {
                var jPlatform = {}
                jPlatform.platformAccountId = this.form.accountNameList[j].id
                jPlatform.title = this.selectedRows[i].contentTitle
                jPlatform.platformId = this.form.accountNameList[j].platformId
                if (this.form.accountNameList[j].cookie == null || this.form.accountNameList[j].cookie == '') {
                  this.$message.warning(
                    this.getPlatFormName(this.form.accountNameList[j].platformId) +
                    '账号：' +
                    this.form.accountNameList[j].id +
                    '登录过期，请前往账号管理重新登录'
                  )
                  return
                }

                console.log(this.form.accountNameList[j].cookie)
                var _cookie = JSON.parse(this.form.accountNameList[j].cookie)

                jPlatform.covers = [this.selectedRows[i].mbLogoUrl]
                // jPlatform.isOriginal = 0

                // var _cookie = [{"name":"gfgarrcache_29674012","value":"1","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4/","secure":false,"httpOnly":false,"session":false,"expirationDate":1691455086.957832,"sameSite":"unspecified"},{"name":"gfgarrcache_bfc6c4e5","value":"1","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4/","secure":false,"httpOnly":false,"session":false,"expirationDate":1691455124.909919,"sameSite":"unspecified"},{"name":"x-jupiter-uuid","value":"16908502688897366","domain":"mp.toutiao.com","hostOnly":true,"path":"/profile_v4","secure":false,"httpOnly":true,"session":false,"expirationDate":1691455085.414464,"sameSite":"unspecified"},{"name":"passport_csrf_token","value":"ae2822695ab8484cc64cb66e46f94c33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":false,"session":false,"expirationDate":1696034287.851719,"sameSite":"no_restriction"},{"name":"passport_csrf_token_default","value":"ae2822695ab8484cc64cb66e46f94c33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1696034287.851747,"sameSite":"unspecified"},{"name":"s_v_web_id","value":"verify_lkrklua0_AedKsl2T_Jsjz_4hDR_8VXu_1txNLyoK7GYo","domain":"mp.toutiao.com","hostOnly":true,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1696034290,"sameSite":"unspecified"},{"name":"_ba","value":"BA0.2-20230801-5110e-x0PAli3vNyHRWI4z9GxU","domain":".mp.toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":false,"session":false,"expirationDate":1753922290,"sameSite":"unspecified"},{"name":"ttwid","value":"1%7CC8Rf4-tl54oVhKQqm_ZYkOwvmLq3l7XKhwqKr_gfjRk%7C1690850274%7Cb057f77359aa43230cd6ffe598a7931c4a03b6e289423f95dc02f0d8b0bda302","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1722386291.251357,"sameSite":"no_restriction"},{"name":"d_ticket","value":"cc2701a786149588d6bd41541db22f443bb33","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.517699,"sameSite":"unspecified"},{"name":"n_mh","value":"SQMIVkn0ZI3dBLrve6IKic_UJ7rK0bsMaYj6timX0J8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1701218323.517783,"sameSite":"unspecified"},{"name":"sso_auth_status","value":"eab125aae2060614dc2d28ba70118602","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1693442323.51785,"sameSite":"unspecified"},{"name":"sso_auth_status_ss","value":"eab125aae2060614dc2d28ba70118602","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1693442323.517871,"sameSite":"no_restriction"},{"name":"sso_uid_tt","value":"e07be974bcbde5d103843354fb7d70af","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034323.517893,"sameSite":"unspecified"},{"name":"sso_uid_tt_ss","value":"e07be974bcbde5d103843354fb7d70af","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517927,"sameSite":"no_restriction"},{"name":"toutiao_sso_user","value":"6c7234f2d3e520de00e4fb92db67df13","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034323.517953,"sameSite":"unspecified"},{"name":"toutiao_sso_user_ss","value":"6c7234f2d3e520de00e4fb92db67df13","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517972,"sameSite":"no_restriction"},{"name":"sid_ucp_sso_v1","value":"1.0.0-KDU4NjQ1YzFjZmExNWI5MmUxYjE0OWU1N2ZjZjY1Y2ZjYjIxZDI2NWUKHwit0qCMs4zZARCCqKGmBhjPCSAMMPewzJEGOAJA8QcaAmxmIiA2YzcyMzRmMmQzZTUyMGRlMDBlNGZiOTJkYjY3ZGYxMw","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.517992,"sameSite":"unspecified"},{"name":"ssid_ucp_sso_v1","value":"1.0.0-KDU4NjQ1YzFjZmExNWI5MmUxYjE0OWU1N2ZjZjY1Y2ZjYjIxZDI2NWUKHwit0qCMs4zZARCCqKGmBhjPCSAMMPewzJEGOAJA8QcaAmxmIiA2YzcyMzRmMmQzZTUyMGRlMDBlNGZiOTJkYjY3ZGYxMw","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034323.518013,"sameSite":"no_restriction"},{"name":"odin_tt","value":"6a3ff1a232ff32ff4cc8b3cdd74e9cf4b81d1495b86fea9960746a30bd490e76f43667fbe2a4eb0a5c7035cd220dfa719aacdc2c97ed86cb2b88ddf6c8d46cfd","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.758879,"sameSite":"unspecified"},{"name":"passport_auth_status","value":"3fe4e38ca97fc61b48199b00dd246f9e%2C42b61cf9a976c609e0b9a57e7d3d1e6e","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1693442323.758967,"sameSite":"unspecified"},{"name":"passport_auth_status_ss","value":"3fe4e38ca97fc61b48199b00dd246f9e%2C42b61cf9a976c609e0b9a57e7d3d1e6e","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1693442323.759,"sameSite":"no_restriction"},{"name":"sid_guard","value":"ba1f1e87af17351b13165b03404b3fc8%7C1690850307%7C5184001%7CSat%2C+30-Sep-2023+00%3A38%3A28+GMT","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1721954323.759038,"sameSite":"unspecified"},{"name":"uid_tt","value":"e08b69b3c3ff62fb2dbdf586760ede71","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759068,"sameSite":"unspecified"},{"name":"uid_tt_ss","value":"e08b69b3c3ff62fb2dbdf586760ede71","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759095,"sameSite":"no_restriction"},{"name":"sid_tt","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759123,"sameSite":"unspecified"},{"name":"sessionid","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1696034324.759148,"sameSite":"unspecified"},{"name":"sessionid_ss","value":"ba1f1e87af17351b13165b03404b3fc8","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759173,"sameSite":"no_restriction"},{"name":"sid_ucp_v1","value":"1.0.0-KGMxYTBkNDJjYTRiZjQ2ODg4ZWQ0NzEwMTlkYjJhZmM5ZDAwMzZiYjMKGQit0qCMs4zZARCDqKGmBhjPCSAMOAJA8QcaAmxmIiBiYTFmMWU4N2FmMTczNTFiMTMxNjViMDM0MDRiM2ZjOA","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.7592,"sameSite":"unspecified"},{"name":"ssid_ucp_v1","value":"1.0.0-KGMxYTBkNDJjYTRiZjQ2ODg4ZWQ0NzEwMTlkYjJhZmM5ZDAwMzZiYjMKGQit0qCMs4zZARCDqKGmBhjPCSAMOAJA8QcaAmxmIiBiYTFmMWU4N2FmMTczNTFiMTMxNjViMDM0MDRiM2ZjOA","domain":".toutiao.com","hostOnly":false,"path":"/","secure":true,"httpOnly":true,"session":false,"expirationDate":1696034324.759234,"sameSite":"no_restriction"},{"name":"store-region","value":"cn-js","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.759259,"sameSite":"unspecified"},{"name":"store-region-src","value":"uid","domain":".toutiao.com","hostOnly":false,"path":"/","secure":false,"httpOnly":true,"session":false,"expirationDate":1722386323.759281,"sameSite":"unspecified"},{"name":"csrf_session_id","value":"24f87f3a3c4daff0c1c7bebb51de9eb3","domain":"mp.toutiao.com","hostOnly":true,"path":"/","secure":true,"httpOnly":false,"session":true,"sameSite":"no_restriction"}]
                jPlatform.cookie = JSON.stringify(_cookie)
                jPlatform.desc = this.selectedRows[i].contentTitle
                // jPlatform.tags = null
                jPlatform.taskId = '123231'
                jPlatform.token = null
                jPlatform.contentList = []
                ;(jPlatform.authorId = ' '), // 必填
                  (jPlatform.authorName = ' ') // 必填
                jPlatforms.push(jPlatform)
              }
              // console.log(jPlatforms)
              publishData.jPlatforms = jPlatforms
              // console.log(JSON.stringify(publishData))
              //todo 点击发布时 查询是否可以发布，有没有重复数据
              var tempParam = {}
              tempParam.accountId = jPlatform.platformAccountId
              tempParam.contentId = this.selectedRows[i].contentNo
              var flag = true
              postAction('/acount/third/checkPublishRecord', tempParam).then(res => {
                if (res.result > 0) {
                  this.$message.warning(this.selectedRows[i].contentTitle + '已发布至该平台请检查')
                  this.showPublishNewModel = false
                  flag = false
                } else {
                  let waitArr = []
                  this.socket.emit('publish', JSON.stringify(publishData), response => {
                    console.log(JSON.parse(response))
                  })

                  this.socket.on('publish-progress', data => {
                    console.log(JSON.parse(data))
                    this.process = JSON.parse(data).data.progress
                    const mes = JSON.parse(data).message
                    if (waitArr.indexOf(mes) === -1) {
                      waitArr.push(mes)
                      // this.$message.warning(JSON.parse(data).message)
                    }

                    if (JSON.parse(data).message == '同步成功') {
                      //todo 发布成功后 插入自己数据库 内容id，平台id，平台账号，时间
                      // var tempParam = {}
                      // tempParam.contentNo = this.selectedRows[i].contentNo
                      // tempParam.platformId = JSON.parse(data).platformId
                      // tempParam.accountId = JSON.parse(data).platformAccountId
                      // tempParam.type = '4'
                      // console.log(tempParam)
                      // postAction('/acount/third/publishRecord', tempParam).then(res => {
                      //   if (res.success) {
                      //     this.$message.success("发布成功")
                      //     this.showPublishNewModel = false
                      //   }
                      // })
                    }
                  })

                  this.socket.on('publish-status', data => {
                    console.log(JSON.parse(data))
                    if (JSON.parse(data).code == 200) {
                      var tempParam = {}
                      tempParam.contentNo = this.selectedRows[i].contentNo
                      tempParam.platformId = JSON.parse(data).platformId
                      tempParam.accountId = JSON.parse(data).platformAccountId
                      tempParam.type = '4'
                      tempParam.publishId = JSON.parse(data).data.publishId
                      console.log(tempParam)
                      postAction('/acount/third/publishRecord', tempParam).then(res => {
                        if (res.success) {
                          this.$message.success('发布成功')
                          this.showPublishNewModel = false
                          this.resetData()
                        }
                      })
                    }
                  })
                }
              })
            }
          }

          this.loading = false
        }
      },
      changeNotify(value){
        this.form.accountNameList[this.tempIndex].notifySubscribers = value
        console.log(this.form.accountNameList[this.tempIndex].notifySubscribers)

      },
      priview() {
        if (this.selectedRows[0].contentType != '1') {
          this.$message.warning('暂时只支持文章类型的预览，其他类型预览敬请期待')
          return
        }
        if (this.tempPlatformId === '20' && !this.wxPreviewAccount) {
          this.$message.warning('请输入预览账号')
          return
        }

        if (this.showPublishNewModelDirect == true) {
          let tempData = {
            contentType: '1',
            contentTitle: this.tempTitle,
            content: this.tempContent,
            mbLogoUrl: this.tempBanner
          }
          this.selectedRows.push(tempData)
        }
        if (this.tempPlatformId == '1') {
          this.previewloading = true

          for (let i = 0; i < this.selectedRows.length; i++) {
            var publishData = {}
            publishData.title = this.selectedRows[i].contentTitle
            publishData.content = this.selectedRows[i].content
            publishData.mediaContentType = 'Article'

            publishData.merchantToken = this.merchantToken
            publishData.publishTypeEnum = 'save'
            var jPlatforms = []
            // for(let j =0 ; j < this.form.accountNameList.length ; j ++){
            var jPlatform = {}
            var contentList = {}
            var contentLists = []
            jPlatform.platformAccountId = this.form.accountNameList[this.tempIndex].id
            jPlatform.title = this.selectedRows[i].contentTitle
            jPlatform.platformId = Number(this.form.accountNameList[this.tempIndex].platformId)
            if (
              this.form.accountNameList[this.tempIndex].cookie == null ||
              this.form.accountNameList[this.tempIndex].cookie == ''
            ) {
              this.$message.warning(
                this.getPlatFormName(this.form.accountNameList[this.tempIndex].platformId) +
                '账号：' +
                this.form.accountNameList[this.tempIndex].id +
                '登录过期，请前往账号管理重新登录'
              )
              this.previewloading = false

              return
            }
            var _cookie = JSON.parse(this.form.accountNameList[this.tempIndex].cookie)
            jPlatform.covers = [this.selectedRows[i].mbLogoUrl]
            jPlatform.cookie = JSON.stringify(_cookie)
            jPlatform.desc = this.selectedRows[i].contentTitle
            jPlatform.taskId = this.uuid()
            jPlatform.token = null
            jPlatform.contentList = []
            ;(jPlatform.authorId = ' '), // 必填
              (jPlatform.authorName = ' ') // 必填
            jPlatform.contentList = contentLists
            jPlatforms.push(jPlatform)
            // }
            publishData.jPlatforms = jPlatforms
            console.log(publishData)
            const draftId = ''
            this.socket.emit('publish', JSON.stringify(publishData), response => {
              // 获取draftId
              console.log(JSON.parse(response))
            })

            this.socket.on('publish-status', data => {
              if (JSON.parse(data).code == -1) {
                // this.$message.warning(JSON.parse(data).message)
                this.previewloading = false
              }
              // console.log(JSON.parse(data))
              // console.log(JSON.parse(data).data.publishId);
              if (publishData.publishTypeEnum != null) {
                //是草稿 再调用一次
                publishData.jPlatforms[0].draftId = JSON.parse(data).data.publishId
                publishData.taskId = this.uuid()
                delete publishData.publishTypeEnum
                console.log(publishData)
                this.socket.emit('publish', JSON.stringify(publishData), response => {
                  console.log(JSON.parse(response))
                })
              }
              if (JSON.parse(data).data.dataBody != null && JSON.parse(data).data.dataBody != '') {
                //返回了预览二维码
                this.ttPreview = JSON.parse(data).data.dataBody

                this.ttPreviewFlag = true
                this.previewloading = false
              }
            })

            // this.socket.on('publish-progress',(data)=>{
            //     console.log(JSON.parse(data))
            // })
          }
        } else if (this.tempPlatformId == '20') {
          this.previewloading = true

          console.log(this.selectedRows.length)
          //检测是否关注
          var accounts = []
          if (this.wxPreviewAccount == null || this.wxPreviewAccount == '') {
            this.$message.warning('请输入预览账号')
            return
          } else {
            accounts = this.wxPreviewAccount.split(',')
          }
          const params = {
            platformId: 20,
            cookie: this.form.accountNameList[this.tempIndex].cookie,
            accountId: this.form.accountNameList[this.tempIndex].id,
            mediaTypeEnum: 'Article',
            previewUserList: accounts // 需要检测的微信号，
          }

          this.socket.emit('check-user-follow', JSON.stringify(params), response => {
            if (
              JSON.parse(response).errorInfo != undefined &&
              JSON.parse(response).errorInfo != null &&
              JSON.parse(response).errorInfo != ''
            ) {
              this.$message.warning(JSON.parse(response).errorInfo)
            }
            return
          })
          var publishData = {}
          publishData.title = this.selectedRows[0].contentTitle
          publishData.content = this.selectedRows[0].content
          publishData.mediaContentType = 'Article'
          publishData.merchantToken = this.merchantToken
          publishData.publishTypeEnum = 'save'
          var jPlatforms = []
          // for(let j =0 ; j < this.form.accountNameList.length ; j ++){
          var jPlatform = {}
          var contentLists = []
          jPlatform.platformAccountId = this.form.accountNameList[this.tempIndex].id
          jPlatform.title = this.selectedRows[0].contentTitle
          jPlatform.platformId = Number(this.form.accountNameList[this.tempIndex].platformId)
          if (
            this.form.accountNameList[this.tempIndex].cookie == null ||
            this.form.accountNameList[this.tempIndex].cookie == ''
          ) {
            this.$message.warning(
              this.getPlatFormName(this.form.accountNameList[this.tempIndex].platformId) +
              '账号：' +
              this.form.accountNameList[this.tempIndex].id +
              '登录过期，请前往账号管理重新登录'
            )
            this.previewloading = false
            return
          }
          var _cookie = JSON.parse(this.form.accountNameList[this.tempIndex].cookie)
          jPlatform.covers = [this.selectedRows[0].mbLogoUrl]
          jPlatform.cookie = JSON.stringify(_cookie)
          jPlatform.desc = this.selectedRows[0].contentTitle
          jPlatform.taskId = this.uuid()
          jPlatform.token = null
          ;(jPlatform.authorId = ' '), // 必填
            (jPlatform.authorName = ' ') // 必填

          for (let i = 0; i < this.selectedRows.length; i++) {
            var contentList = {}
            contentList.title = this.selectedRows[i].contentTitle
            contentList.author = ' '
            contentList.content = this.selectedRows[i].content
            contentList.coverPathOrUrl = this.selectedRows[i].mbLogoUrl
            contentList.desc = this.selectedRows[i].contentTitle
            if (this.form.accountNameList[this.tempIndex].needOpenComment != null) {
              contentList.needOpenComment = this.form.accountNameList[this.tempIndex].needOpenComment
            }
            if (this.form.accountNameList[this.tempIndex].desc != null) {
              contentList.desc = this.form.accountNameList[j].desc
            }
            if (this.form.accountNameList[this.tempIndex].contentSourceUrl != null) {
              contentList.contentSourceUrl = this.form.accountNameList[this.tempIndex].contentSourceUrl
            }
            if (this.form.accountNameList[this.tempIndex].yc != null) {
              contentList.isOriginal = 1
            } else {
              contentList.isOriginal = 0
            }
            //处理topics
            contentList.topics = this.tags
            // if (this.form.accountNameList[this.tempIndex].topicstr != null) {
            //   var topics = []
            //   for (var x = 0; x < this.form.accountNameList[this.tempIndex].topicstr.split(',').length; x++) {
            //     topics.push({ id: '', title: this.form.accountNameList[this.tempIndex].topicstr.split(',')[x] })
            //   }
            //   contentList.topics = topics
            // }

            contentLists.push(contentList)
          }
          jPlatform.contentList = contentLists
          jPlatforms.push(jPlatform)
          // }
          publishData.jPlatforms = jPlatforms
          console.log(publishData)
          const draftId = ''
          this.socket.emit('publish', JSON.stringify(publishData), response => {
            // 获取draftId
            console.log(JSON.parse(response))
          })

          this.socket.on('publish-status', data => {
            console.log(JSON.parse(data))
            console.log(publishData.publishTypeEnum)
            // console.log(JSON.parse(data).data.publishId);
            if (publishData.publishTypeEnum != null) {
              //是草稿 再调用一次
              publishData.jPlatforms[0].draftId = JSON.parse(data).data.publishId
              publishData.taskId = this.uuid()
              publishData.jPlatforms[0].previewUserList = accounts
              delete publishData.publishTypeEnum
              console.log(publishData)
              this.socket.emit('publish', JSON.stringify(publishData), response => {
                console.log(JSON.parse(response))
              })
              this.socket.on('publish-progress', data => {
                console.log(JSON.parse(data))
              })
            }
            if (JSON.parse(data).data.error != null) {
              // this.$message.warning(JSON.parse(data).message)
              this.previewloading = false
            } else if (JSON.parse(data).data.resultInfo == '已发送预览') {
              this.$message.success('已发送预览，请查看')
              this.previewloading = false

              // this.closePublish()
            }
          })
        }
      },
      nextStep() {
        console.log(this.selectedRows, 'this.selectedRows')
        if (!this.selectedRows || this.selectedRows.length === 0) {
          this.$message.warning('请先勾选要发布的内容')
          return
        }
        this.step++
        this.value1 = this.selectedRows[0]
        this.changeArticle(this.value1.id)
      },
      changeArticle(item) {
        console.log(this.activeKey)
        console.log(item)
        if (this.activeKey == 0) {
          this.activeKey = item
        }
        console.log(this.activeKey)

        for (var i = 0; i < this.selectedRows.length; i++) {
          if (this.selectedRows[i].id == this.activeKey) {
            this.tempTitle = this.selectedRows[i].contentTitle
            this.tempBanner = this.selectedRows[i].mbLogoUrl
            return
          }
        }
      },
      handleOk() {
        console.log(
          this.accountList[this.platformIndex].dialogAccountNameList,
          'accountList[platformIndex].dialogAccountNameList'
        )
        this.form.accountNameList = []
        var tempPlatformList = []
        console.log('333', this.form.accountNameList)
        console.log(this.accountList)
        for (var i = 0; i < this.accountList.length; i++) {
          if (null != this.accountList[i].dialogAccountNameList) {
            for (var j = 0; j < this.accountList[i].dialogAccountNameList.length; j++) {
              this.form.accountNameList.push(this.accountList[i].dialogAccountNameList[j])
              var flag = true
              for (var x = 0; x < tempPlatformList.length; x++) {
                if (this.accountList[i].dialogAccountNameList[j].platformId == tempPlatformList[x]) {
                  flag = false
                }
              }
              if (flag) {
                tempPlatformList.push(this.accountList[i].dialogAccountNameList[j].platformId)
              }
            }
            // 被选中的账号 this.form.accountNameListSelected
            this.form.accountNameListSelected = []
            for (var y = 0; y < this.form.accountNameList.length; y++) {
              if (this.form.accountNameList[y].platformId == tempPlatformList[0]) {
                this.form.accountNameListSelected.push(this.form.accountNameList[y])
              }
            }
          }
        }
        this.platformSelected = tempPlatformList
        console.log(this.form.accountNameList)
        //封装动态的选中的

        // this.form.accountNameList = this.dialogAccountNameList
        this.tempPlatformId = this.dialogTempPlatformId
        this.getHot(this.form.accountNameList[0], 0)
        this.chooseModalopen = false
      },
      setPlatFormIndex(index) {
        this.platformIndex = index
        console.log(this.accountList, 'this.accountList')
        console.log(this.accountList[this.platformIndex], 'accountList[platformIndex]')
      },
      getPlatFormName(id) {
        for (let i = 0; i < this.dataArrNew.length; i++) {
          if (this.dataArrNew[i].id == id) {
            return this.dataArrNew[i].name
          }
        }
      },
      savePlatForm(item) {
        console.log(item)
        this.dialogTempPlatformId = item.platformId
        // this.allPlatformAccountIds.push(item.platformId)
      },
        // 打开回收站
      handleBin() {
        this.visible = true;
        // 用来测试展示的数据
        postAction('content/contentInfo/getDeletedData', []).then(res => {
          if (res.success) {
            this.delDataSource = res.result
          }
        })
        // this.delDataSource = [];
      },
      recover(item){
        postAction('content/contentInfo/recover', item).then(res => {
          if (res.success) {
            this.$message.success('恢复成功');
            this.loadData();
            this.visible =false
          }
        })
      },
      closeBin(){
        this.visible = false
      },
      tabChange(activeKey) {
        if (activeKey === 'mine') {
          this.url.list = 'content/contentInfo/myContentList';
        } else {
          //待定
          this.url.list = '/content/contentInfo/list';
        }
        this.loadData(1);
      },
      getContentTypeName(contentType) {
        const contentTypeItem = findContentType(contentType);
        if (contentTypeItem) {
          return contentTypeItem.name
        }
      },
      getQueryField() {
        return '';
      },
      //查看
      look(item) {
        this.currentItem = item;
        this.showDetail = true;
      },
      //打印
      print(item) {
        this.currentItem = item;
        this.showPrint = true;
      },
      //发布(第三方平台)
      publish() {
        this.showPublishModel = true;
      },
      showPublishSetting(item, index) {
        this.$refs.publishSetting.show(item.taskId, 'content');
      },
      deleteContent(item, index){
        let that  = this;
        postAction('content/contentInfo/delete', item).then(res => {
          if (res.success) {
            this.$message.success('删除成功');
            this.loadData();
          } else {
            this.$message.error(res.message)
          }
        })
      },

      //保存到内容库
      addTemplate(item, index) {
        this.currentItem = index;
        this.syncing = true;
        // const {contentTitle,contentSubTitle,authorName,content,videoUrl,voiceUrl,htmlUrl} = item;
        postAction('content/contentTemplate/addTemplate', item).then(res => {
          if (res.success) {
            this.$message.success('同步成功');
            this.loadData();
          } else {
            this.$message.error(res.message);
          }
        }).finally(() => {
          this.syncing = false;
          this.currentItem = -1;
        })
      },
      // 发布到官网
      async publishNet(item){
        const res = await postAction('third/news/add',{
          contentTitle:item.contentTitle,
          contentNo:item.contentNo,

          content:item.content,
          authorName:item.authorName,
          remark:item.remark
        });
        if(res.success){
          this.$message.success(res.message);
        }else{

          this.$message.error(res.message);
        }
      }
    },

  }

</script>

<style scoped lang="less">
  @import '~@assets/fonts/iconfont.css';

  .item {
    background-color: white;
    border-radius: 8px;
    padding: 20px 30px;
    margin: 10px 0;

    &-title {
      font-weight: 700;
      color: #333;
      font-size: 16px;
    }

    &-content {
      display: flex;
      font-size: 13px;
      align-items: center;

      &-title {
        font-size: 15px;
        line-height: 25px;
      }
    }

    &-content .ant-row-flex {
      margin: 5px 0;
    }

    &-icon {
      width: 180px;
      height: 120px;
      border-radius: 5px;
      border: 1px solid #ededed;
      margin-right: 20px;
    }
  }

  .printTitle {
    width: 100%;
    text-align: center;
    font-size: 18px;
    margin: 10px 0px;
    color: #333;
  }

  .printContent img {
    max-width: 100%;
  }
  .j-table-force-nowrap {
    td, th {
      white-space: nowrap;
    }

    .ant-table-selection-column {
      padding: 12px 22px !important;
    }

    /** 列自适应，弊端会导致列宽失效 */
    &.ant-table-wrapper .ant-table-content {
      overflow-x: auto;
    }
  }

</style>
